<template>
  <div id="app">
    <h1>{{ store.count }}</h1>
    <button @click="handleClick">增加</button>
  </div>
</template>

<script setup>
import { store } from "./store";

const props = defineProps({
  setGlobalState: {
    type: Function,
    required: false,
  },
});
const handleClick = () => {
  store.count++;
  props.setGlobalState({
    count: store.count,
  });
};
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
